package com.deyuanyun.pic.settings.controller.vo;

import com.deyuanyun.pic.common.util.NumberUtil;
import com.deyuanyun.pic.common.util.StringUtils;
import com.deyuanyun.pic.settings.domain.prvlg.Role;
import com.deyuanyun.pic.settings.support.biz.CodeUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.util.Date;
import java.util.List;

public class RoleVO extends SettingsBaseVO<Role> {

    // 角色名称
    private String name;
    // 角色编号
    private String code;
    // 角色编号
    private Short state;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Short getState() {
        return state;
    }

    public void setState(Short state) {
        this.state = state;
    }

    @Override
    public void fromDomain(Role domain) {

        // 角色名称
        this.name = domain.getName();
        // 角色编号
        this.code = domain.getCode();
        // 角色编号
        this.state = domain.getState();

        super.fromDomain(domain.getId(), domain.getCreateRemark());
    }

    public List<RoleVO> fromDomainList(List<Role> domainList) {
        List<RoleVO> list = new Page<RoleVO>();
        for (Role role : domainList) {
            RoleVO roleVO = new RoleVO();
            roleVO.fromDomain(role);
            list.add(roleVO);
        }
        return list;
    }
}